// const { response } = require("express")
const express =require(`express`)
const path =require(`path`)
const app=express()

// query

app.get(`/user`,(request,response)=>{

  const{
    userId
  } =request.query;

  if (userId !== "001"){

    return response.send(
      {
        code:10001,
        msg:`查询失败`,
        data:null
      }
    )
  
  }
  response.send({
    code:10001,
    msg:`查询成功`,
    data:{
      name:"Firo",
      age:18,
      sex:`🚹`
    }
  })

})







//静态资源部署接口
app.get("/1",(req,res)=>{

  const FilePath =path.resolve(__dirname,"./学生.html")

  res.sendFile(FilePath)
})
app.listen(3000,()=>{

  console.log(`请求服务器 http://127.0.0.1:3000`);
})